﻿<%@ Control Language="C#" AutoEventWireup="true" CodeFile="FormItemCommissionApplicability.ascx.cs" Inherits="Apollo.Website.Controls_Edit_FormItemCommissionApplicability" %>
<%@ Register Src="~/Controls/Edit/FormItemRelation.ascx" TagPrefix="apollo" TagName="FormItemRelation" %>

<script type="text/javascript">
    function ChangeCommissionApplicability(ddl) {

        document.getElementById('applicability_rel_1').style.display = "none";
        document.getElementById('applicability_rel_2').style.display = "none";
        document.getElementById('applicability_rel_3').style.display = "none";
        document.getElementById('applicability_rel_4').style.display = "none";

        if(ddl.selectedIndex > 0 && ddl.options[ddl.selectedIndex].value != "-1") {
            var selectedSpanId = "applicability_rel_" + ddl.options[ddl.selectedIndex].value;

            document.getElementById(selectedSpanId).style.display = 'block';
        }

        if (ddl.selectedIndex > 0 && ddl.options[ddl.selectedIndex].value == "-1") {
            document.getElementById('applicability_rel_1').style.display = "block";
            document.getElementById('applicability_rel_2').style.display = "block";
            document.getElementById('applicability_rel_3').style.display = "block";
            document.getElementById('applicability_rel_4').style.display = "block";
        }
    }

    $(document).ready(function () {
        ChangeCommissionApplicability(document.getElementById('<%= this.DropDownListCommissionApplicability.ClientID %>'));
    });
</script>

<table width="100%" cellpadding="0" cellspacing="0" border="0">
    <tr>
        <td width="50%">
            <span class="property_name">Applicability</span>
            <asp:DropDownList ID="DropDownListCommissionApplicability" runat="server" CssClass="property_value">
                <asp:ListItem Value="0">All</asp:ListItem>
                <asp:ListItem Value="1">Role</asp:ListItem>
                <asp:ListItem Value="2">Position</asp:ListItem>
                <asp:ListItem Value="3">Employee</asp:ListItem>
                <asp:ListItem Value="4">Contract</asp:ListItem>
                <asp:ListItem Value="-1">Accelerator</asp:ListItem>
            </asp:DropDownList>
        </td>
        <td width="50%">
            <div id="applicability_rel_1" style="display: none; clear: both; padding: 1px;"><apollo:FormItemRelation ID="FormItemRelationRole" runat="server" /></div>
            <div id="applicability_rel_2" style="display: none; clear: both; padding: 1px;"><apollo:FormItemRelation ID="FormItemRelationPosition" runat="server" /></div>
            <div id="applicability_rel_3" style="display: none; clear: both; padding: 1px;"><apollo:FormItemRelation ID="FormItemRelationEmployee" runat="server" /></div>
            <div id="applicability_rel_4" style="display: none; clear: both; padding: 1px;"><apollo:FormItemRelation ID="FormItemRelationContract" runat="server" /></div>
        </td>
    </tr>
</table>